#!/bin/bash

path=`cd "$( dirname ${BASH_SOURCE[0]} )" && pwd`
cd $path
source config.sh
#检测系统类型
source $bin/get_platform.sh
echo ==================================
echo 请选择需要修改的工具
echo 1.修改pip环境变量
echo ==================================
read -p "请选择：" tool
if [[ $tool = 1 ]];then
	tool=pip
    echo ==================================
    echo 请选择修改的方式
    echo 1.全局修改
    echo ==================================
    read -p "请选择：" conf
    if [[ $conf = 1 ]];then
        cmd="$tool config set global." 
    else
        echo "没有这个选项。"
        exit
    fi
    echo ==================================
    echo 请选择需要修改的环境变量
    echo "1.修改pip源："`pip config get global.index-url`
    echo "2.修改pip缓存目录："`pip config get global.cache-dir`
    echo ==================================
    read -p "请选择：" key
    if [[ $key = 1 ]];then
        cmd="$cmd""index-url"
    elif [[ $key = 1 ]];then
        cmd="$cmd""cache-dir"
    else
        echo "没有这个选项。"
        exit
    fi
    echo ==================================
    echo 请输入值：
    echo ==================================
    read -p "请输入值：" value
    $cmd $value
elif [[ $tool = 2 ]];then
	tool=node
elif [[ $tool = 3 ]];then
	tool=java
else
	echo "没有这个选项。"
	exit
fi
